home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Software / Trial / TestTrack Pro 6 / ttprowininstall.exe / %LSMAINDIR% / LicenseServer Help / wwhelp / wwhimpl / js / scripts / outlfast.js < prev    next >
Encoding:
JavaScript  |  2003-12-12  |  6.3 KB  |  218 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHOutlineImagingFast_Object()
  5. {
  6.   this.mIterator      = new WWHOutlineIterator_Object(true);
  7.   this.mImageSrcDir   = WWHOutlineImaging_ImageSrcDir();
  8.   this.mEventString   = WWHPopup_EventString();
  9.   this.mHTMLSegment   = new WWHStringBuffer_Object();
  10.  
  11.   this.fGetIconURL     = WWHOutlineImaging_GetIconURL;
  12.   this.fGetPopupAction = WWHOutlineImaging_GetPopupAction;
  13.   this.fGetLink        = WWHOutlineImaging_GetLink;
  14.  
  15.   this.fGenerateStyles = WWHOutlineImagingFast_GenerateStyles;
  16.   this.fReset          = WWHOutlineImagingFast_Reset;
  17.   this.fAdvance        = WWHOutlineImagingFast_Advance;
  18.   this.fOpenLevel      = WWHOutlineImagingFast_OpenLevel;
  19.   this.fCloseLevel     = WWHOutlineImagingFast_CloseLevel;
  20.   this.fSameLevel      = WWHOutlineImagingFast_SameLevel;
  21.   this.fDisplayEntry   = WWHOutlineImagingFast_DisplayEntry;
  22.   this.fUpdateEntry    = WWHOutlineImagingFast_UpdateEntry;
  23.   this.fRevealEntry    = WWHOutlineImagingFast_RevealEntry;
  24. }
  25.  
  26. function  WWHOutlineImagingFast_GenerateStyles()
  27. {
  28.   var  StyleBuffer = new WWHStringBuffer_Object();
  29.  
  30.  
  31.   StyleBuffer.fAppend("<style type=\"text/css\">\n");
  32.   StyleBuffer.fAppend(" <!--\n");
  33.   StyleBuffer.fAppend("  a  { text-decoration: none ;\n");
  34.   StyleBuffer.fAppend("       color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + " }\n");
  35.   StyleBuffer.fAppend("  ul { list-style-type: none ;\n");
  36.   StyleBuffer.fAppend("       padding-left: 0pt ;\n");
  37.   StyleBuffer.fAppend("       margin-top: 1pt ;\n");
  38.   StyleBuffer.fAppend("       margin-bottom: 1pt ;\n");
  39.   StyleBuffer.fAppend("       margin-left: 0pt }\n");
  40.   StyleBuffer.fAppend("  li { margin-top: 1pt ;\n");
  41.   StyleBuffer.fAppend("       margin-bottom: 1pt ;\n");
  42.   StyleBuffer.fAppend("       " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + " ;\n");
  43.   StyleBuffer.fAppend("       margin-left: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mIndent + "pt }\n");
  44.   StyleBuffer.fAppend("  li.book { margin-left: 0pt }\n");
  45.   StyleBuffer.fAppend(" -->\n");
  46.   StyleBuffer.fAppend("</style>\n");
  47.  
  48.   return StyleBuffer.fGetBuffer();
  49. }
  50.  
  51. function  WWHOutlineImagingFast_Reset()
  52. {
  53.   this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry);
  54. }
  55.  
  56. function  WWHOutlineImagingFast_Advance(ParamMaxHTMLSegmentSize)
  57. {
  58.   var  Entry;
  59.  
  60.  
  61.   this.mHTMLSegment.fReset();
  62.   while (((ParamMaxHTMLSegmentSize == -1) ||
  63.           (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) &&
  64.          (this.mIterator.fAdvance(this)))
  65.   {
  66.     Entry = this.mIterator.mEntry;
  67.  
  68.     // Process current entry
  69.     //
  70.     if (Entry.mbShow)
  71.     {
  72.       if (Entry.mLevel == 0)
  73.       {
  74.         this.mHTMLSegment.fAppend("<li class=book id=i" + Entry.mID + ">");
  75.       }
  76.       else
  77.       {
  78.         this.mHTMLSegment.fAppend("<li id=i" + Entry.mID + ">");
  79.       }
  80.       this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
  81.     }
  82.   }
  83.  
  84.   return (this.mHTMLSegment.fSize() > 0);  // Return true if segment created
  85. }
  86.  
  87. function  WWHOutlineImagingFast_OpenLevel()
  88. {
  89.   this.mHTMLSegment.fAppend("<ul>\n");
  90. }
  91.  
  92. function  WWHOutlineImagingFast_CloseLevel()
  93. {
  94.   this.mHTMLSegment.fAppend("</li>\n");
  95.   this.mHTMLSegment.fAppend("</ul>\n");
  96. }
  97.  
  98. function  WWHOutlineImagingFast_SameLevel()
  99. {
  100.   this.mHTMLSegment.fAppend("</li>\n");
  101. }
  102.  
  103. function  WWHOutlineImagingFast_DisplayEntry(ParamEntry)
  104. {
  105.   var  EntryHTML = "";
  106.   var  IconURL = this.fGetIconURL(ParamEntry);
  107.  
  108.  
  109.   if (ParamEntry.mChildren == null)
  110.   {
  111.     EntryHTML += "<nobr>";
  112.     EntryHTML += this.fGetLink(ParamEntry, "<img width=17 height=17 border=0 src=\"" + IconURL + "\"> ");
  113.     EntryHTML += "</nobr>\n";
  114.   }
  115.   else
  116.   {
  117.     if (ParamEntry.mbExpanded)
  118.     {
  119.       EntryHTML += "<nobr>";
  120.       EntryHTML += "<a href=\"javascript:fC(" + ParamEntry.mID + ");\" " + this.fGetPopupAction(ParamEntry) + ">";
  121.       EntryHTML += "<img width=17 height=17 border=0 src=\"" + IconURL + "\"></a>";
  122.       EntryHTML += " " + this.fGetLink(ParamEntry, null);
  123.       EntryHTML += "</nobr>\n";
  124.     }
  125.     else
  126.     {
  127.       EntryHTML += "<nobr>";
  128.       EntryHTML += "<a href=\"javascript:fE(" + ParamEntry.mID + ");\" " + this.fGetPopupAction(ParamEntry) + ">";
  129.       EntryHTML += "<img width=17 height=17 border=0 src=\"" + IconURL + "\"></a>";
  130.       EntryHTML += " " + this.fGetLink(ParamEntry, null);
  131.       EntryHTML += "</nobr>\n";
  132.     }
  133.   }
  134.  
  135.   return EntryHTML;
  136. }
  137.  
  138. function  WWHOutlineImagingFast_UpdateEntry(ParamEntry)
  139. {
  140.   var  ElementID = "i" + ParamEntry.mID;
  141.   var  EntryHTML = "";
  142.  
  143.  
  144.   // Get entry display
  145.   //
  146.   EntryHTML = this.fDisplayEntry(ParamEntry);
  147.  
  148.   // Reset iterator to process current entry's children
  149.   //
  150.   this.mIterator.fReset(ParamEntry);
  151.  
  152.   // Process display of children
  153.   //
  154.   if (this.fAdvance(-1))
  155.   {
  156.     // Result already stored in this.mHTMLSegment
  157.     //
  158.   }
  159.  
  160.   // Close down any popups we had going to prevent JavaScript errors
  161.   //
  162.   WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();
  163.  
  164.   // Update HTML
  165.   //
  166.   if ((WWHFrame.WWHBrowserInfo.mBrowser == 2) ||  // Shorthand for IE
  167.       (WWHFrame.WWHBrowserInfo.mBrowser == 3))    // Shorthand for iCab
  168.   {
  169.     WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.all[ElementID].innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer();
  170.   }
  171.   else if (WWHFrame.WWHBrowserInfo.mBrowser == 4)  // Shorthand for Netscape 6.0
  172.   {
  173.     WWHFrame.WWHNavigationFrame.WWHPanelFrame.document.getElementById(ElementID).innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer();
  174.   }
  175. }
  176.  
  177. function  WWHOutlineImagingFast_RevealEntry(ParamEntry,
  178.                                             bParamVisible)
  179. {
  180.   var  ParentEntry;
  181.   var  LastClosedParentEntry = null;
  182.  
  183.  
  184.   // Expand out enclosing entries
  185.   //
  186.   ParentEntry = ParamEntry.mParent;
  187.   while (ParentEntry != null)
  188.   {
  189.     if ( ! ParentEntry.mbExpanded)
  190.     {
  191.       ParentEntry.mbExpanded = true;
  192.       LastClosedParentEntry = ParentEntry;
  193.     }
  194.  
  195.     ParentEntry = ParentEntry.mParent;
  196.   }
  197.  
  198.   // Set target entry
  199.   //
  200.   WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID;
  201.  
  202.   // Update display
  203.   //
  204.   if (bParamVisible)
  205.   {
  206.     // Expand parent entry to reveal target entry
  207.     //
  208.     if (LastClosedParentEntry != null)
  209.     {
  210.       this.fUpdateEntry(LastClosedParentEntry);
  211.     }
  212.  
  213.     // Display target
  214.     //
  215.     WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  216.   }
  217. }
  218.